#include<stdio.h>
#include<graphics.h>
#include<conio.h>
int main()
{
	float Pi = 3.14159;//圆周率
	initgraph(1200, 800);//打开一个窗口
	setbkcolor(RGB(128,128,128));//设置背景颜色为灰色
	cleardevice();//以背景颜色清空画布
	int circleX = 300;//圆心x坐标
	int circleY = 300;//圆心y坐标
	int radius = 200;//圆半径

	int i;//计数单位
	float offset;//每组扇形变化的角度
	float totaloffset = 0;//不同半径之间角度的偏移量
	for (circleX = 200; circleX < 1200; circleX = circleX + 400)
	{
		for (circleY = 200; circleY < 800; circleY = circleY + 400)
		{
			float h = rand() % 180;
			COLORREF color1 = HSVtoRGB(h, 0.9, 0.8);
			COLORREF color2 = HSVtoRGB(h + 180, 0.9, 0.8);
			for (radius = 200; radius > 0; radius -= 50)
			{
				int left = circleX - radius;//圆外切矩形左上角x坐标
				int top = circleY - radius;//圆外切矩形左上角y坐标
				int right = circleX + radius;//圆外切矩形右下角x坐标
				int bottom = circleY + radius;//圆外切矩形右下角y坐标
				for (i = 0; i < 20; i++)
				{
					offset = i * Pi / 10 + totaloffset;
					setfillcolor(RGB(0, 240, 220));//设置填充颜色为青色
					setfillcolor(color1);//设置填充颜色为青色
					solidpie(left, top, right, bottom, offset, 2 * Pi / 60 + offset);//画填充扇形
					setfillcolor(RGB(255, 255, 255));//设置填充颜色为白色
					solidpie(left, top, right, bottom, 2 * Pi / 60 + offset, 3 * Pi / 60 + offset);//画填充扇形
					setfillcolor(RGB(200, 0, 0));//设置填充颜色为红色
					setfillcolor(color2);//设置填充颜色为红色
					solidpie(left, top, right, bottom, 3 * Pi / 60 + offset, 5 * Pi / 60 + offset);//画填充扇形
					setfillcolor(RGB(0, 0, 0));//设置填充颜色为黑色
					solidpie(left, top, right, bottom, 5 * Pi / 60 + offset, 6 * Pi / 60 + offset);//画填充扇形
				}
				totaloffset = totaloffset + Pi / 20;
			}
		}
		
	}
	
	
	_getch();
	return 0;
}
